






#import "ShowAlertTool+SVProgressHUD.h"

@implementation ShowAlertTool (SVProgressHUD)



#pragma mark - 显示SVPHUD的 dissmiss
//取消SVPHUD的提示
+ (void)yh_showSVPDismiss{[SVProgressHUD dismiss];}


#pragma mark - 显示SVPHUD的 status 转圈
//显示SVPHUD的转圈
+ (void)yh_showSVPWithStatus:(NSString *)status {
    [SVProgressHUD showWithStatus:status];
}


#pragma mark - 显示SVPHUD的 提示


#define kSVPDismissCompletion

+ (void)yh_showSVPInfo:(NSString *)info time:(NSInteger)dismissTime completion:(alertCompletionBlock)completion{
    
    [SVProgressHUD setForegroundColor:[UIColor blackColor]]; //字体颜色

    
    [SVProgressHUD showInfoWithStatus:info];
    
    [self yh_dismissWithTime:dismissTime completion:completion];
}

+ (void)yh_showSVPInfo:(NSString *)info time:(NSInteger)dismissTime{
    [ShowAlertTool yh_showSVPInfo:info time:dismissTime completion:nil];
}

+ (void)yh_showSVPInfo:(NSString *)info completion:(alertCompletionBlock)completion{
    [ShowAlertTool yh_showSVPInfo:info time:YHDismissTime completion:completion];
}

+ (void)yh_showSVPInfo:(NSString *)info{
     [ShowAlertTool yh_showSVPInfo:info time:YHDismissTime completion:nil];
}




#pragma mark - 显示SVPHUD的 success

+ (void)yh_showSVPSuccessStatus:(NSString *)status time:(NSInteger)dismissTime completion:(alertCompletionBlock)completion{
    
    [SVProgressHUD setForegroundColor:[UIColor blackColor]]; //字体颜色
    
    [SVProgressHUD showSuccessWithStatus:status];
    
    [self yh_dismissWithTime:dismissTime completion:completion];
}

+ (void)yh_showSVPSuccessStatus:(NSString *)status time:(NSInteger)dismissTime{
    
    [self yh_showSVPSuccessStatus:status time:dismissTime completion:nil];
}

+ (void)yh_showSVPSuccessStatus:(NSString *)status completion:(alertCompletionBlock)completion{
    
    [self yh_showSVPSuccessStatus:status time:YHDismissTime completion:completion];
}

+ (void)yh_showSVPSuccessStatus:(NSString *)status{
    
    [self yh_showSVPSuccessStatus:status time:YHDismissTime completion:nil];
}


#pragma mark - 显示SVPHUD的 error

+ (void)yh_showSVPErrorStatus:(NSString *)status time:(NSInteger)dismissTime completion:(alertCompletionBlock)completion{
    
    [SVProgressHUD setForegroundColor:[UIColor blackColor]]; //字体颜色
    
    [SVProgressHUD showErrorWithStatus:status];
    
    [self yh_dismissWithTime:dismissTime completion:completion];
}

+ (void)yh_showSVPErrorStatus:(NSString *)status time:(NSInteger)dismissTime{
    [self yh_showSVPErrorStatus:status time:dismissTime completion:nil];
}
+ (void)yh_showSVPErrorStatus:(NSString *)status completion:(alertCompletionBlock)completion{
    [self yh_showSVPErrorStatus:status time:YHDismissTime completion:completion];
}
+ (void)yh_showSVPErrorStatus:(NSString *)status{
     [self yh_showSVPErrorStatus:status time:YHDismissTime completion:nil];
}

#pragma mark - 定时dissmiss

+ (void)yh_dismissWithTime:(NSInteger)dismissTime completion:(alertCompletionBlock)completion{
    
    YHDISPATCH_AFTER(dismissTime, ^{
        //消失
        [self yh_showSVPDismiss];
        //SVP消失后的回调
        if (completion) {
            completion();
        }
    })
}


@end
